﻿using FluentNHibernate.Mapping;
using easyccms.BusinessLayer.Entities;

namespace easyccms.Nhibernate.Mappings
{
    /// <summary>
    /// Mapping entity to the table in database.
    /// </summary>
    public class MenuItemMap: ClassMap<MenuItem>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="MenuItemMap"/> class.
        /// </summary>
        public MenuItemMap(){
            Table("dbo.MenuItem");
            Id(x => x.MenuItemId);
            Map(x => x.Name);
            Map(x => x.DisplayUntil);
            Map(x => x.ExternalUrl);
            Map(x => x.Created);
            Map(x => x.ItemOrder);
            Map(x => x.Deleted);
            

            HasOne(x => x.Article).Cascade.None();
            References(x => x.Menu).Cascade.None();
            References(x => x.User).Cascade.None();
        }
    }
}
